<template>
  <div class="card content-box">
    <span class="text">审核中心</span>
    <el-tabs type="border-card" style="width: 100%">
      <el-tab-pane label="待审核">
        <el-table :data="petitions" style="width: 100%">
          <el-table-column label="序号" width="100" type="index"> </el-table-column>
          <el-table-column label="信访人" prop="userID"></el-table-column>
          <el-table-column label="主题" prop="title"></el-table-column>
          <el-table-column label="一级分类" prop="eventType"></el-table-column>
          <el-table-column label="部门" prop="petitionDep"></el-table-column>
          <el-table-column label="状态" prop="status"></el-table-column>
          <el-table-column label="操作" width="200">
            <template #default="{ row }">
              <el-button type="success" @click="sure(row.eventID)" :icon="Check" circle></el-button>
              <el-button type="danger" @click="refuse(row.eventID)" :icon="Delete" circle></el-button>
            </template>
          </el-table-column>
          <template #empty>
            <el-empty description="空空如也" />
          </template>
        </el-table>
      </el-tab-pane>
      <el-tab-pane label="审核通过">
        <el-table :data="petitions" style="width: 100%">
          <template #empty>
            <el-empty description="空空如也" />
          </template>
        </el-table>
      </el-tab-pane>
      <el-tab-pane label="不予处理">
        <el-table :data="petitions" style="width: 100%">
          <template #empty>
            <el-empty description="空空如也" />
          </template>
        </el-table>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script setup name="copyDirect">
import { onMounted, ref } from "vue";
import { getNewService, refuseService, sureService } from "@/api/core/funcs";
import { Check, Delete } from "@element-plus/icons-vue";
import { ElMessage } from "element-plus";
//数据类型
const petitions = ref([
  {
    eventID: 1,
    eventType: 1,
    typeName: "",
    userID: 10000000,
    title: "关于程序员每天996的问题",
    description: "hhh",
    petitionDep: "重庆市江北区信访办",
    status: 1,
    statusName: "",
    createdAt: "2024-07-11 20:11:12",
    filePath: "http://www.baidu.com",
    keywords: null,
    workId: null,
    sentiment: 0.06916084606459039,
    degree: 5.0
  }
]);

// const petition = ref({
//   eventID: 1,
//   eventType: 1,
//   typeName: "",
//   userID: 10000000,
//   title: "关于程序员每天996的问题",
//   description: "hhh",
//   petitionDep: "重庆市江北区信访办",
//   status: 1,
//   statusName: "",
//   createdAt: "2024-07-11 20:11:12",
//   filePath: "http://www.baidu.com",
//   keywords: null,
//   workId: null,
//   sentiment: 0.06916084606459039,
//   degree: 5.0
// });

//获取所欲待审核信访
const getDataList = async () => {
  let result = await getNewService();
  petitions.value = result.data;
};
onMounted(getDataList);
//处理部分

//拒接
const refuse = async eventId => {
  await refuseService(eventId);
  ElMessage.warning("事件不予审批");
};

//审核通过
const sure = async eventID => {
  await sureService(eventID);
  ElMessage.success("审核通过");
};
</script>

<style scoped lang="scss">
@import "./index.scss";
</style>
